/*
package concroller;

import java.io.*;
import java.net.Socket;
import java.util.ResourceBundle;
import java.util.Scanner;

public class ManagerController {
    Scanner sc = new Scanner(System.in);
    Socket s = getSocket();
    FruitController fruitController = new FruitController();

    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
    BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));

    public ManagerController() throws IOException {
    }


    public void start() {
        System.out.println("请输入用户名:");
        String name = sc.next();
        System.out.println("请输入密码:");
        String passWord = sc.next();
        //设计通信的报文协议,此处[0]则代表管理员的登录请求,以"[0]" + name+","+passWord格式拼接数据
        String msg = "[0]" + name+","+passWord;
        try {
            bw.write(msg);
            bw.newLine();
            bw.flush();
            String res = br.readLine();
            if (res.equals("true")) {
                System.out.println("欢迎您:" + name);
                fruitController.start();
            } else {
                System.out.println("不要皮,你不是管理员!");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //进行业务处理时经常需要使用到socket,所以此处封装一个方法专门用于获取socket对象
    public Socket getSocket() {
        //本质上相当于Map集合,getString方法相当于通过键去找值
        ResourceBundle rb = ResourceBundle.getBundle("prop");
        try {
            //这样设计的好处在于未来IP地址可以修改,使得客户端和服务器端不一定要运行在同一台电脑上
            return new Socket(rb.getString("ip"), Integer.parseInt(rb.getString("port")));
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
*/
